package com.wfy.modules.sys.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.wfy.common.entity.BaseEntity;

import java.util.List;

/**
 * 菜单Entity
 *
 * @author SmartFactory
 * @version 2013-05-15
 */
@TableName(value = "sys_menu")
public class Menu extends BaseEntity<Menu> implements Comparable {

    @TableField(exist = false)
    private Menu parent;

    @TableField(value = "parent_id")
    private String parentId;

    /**
     * 所有父级编号
     */
    @TableField(value = "parent_ids")
    private String parentIds;

    /**
     * 名称
     */
    private String name;

    /**
     * 链接
     */
    private String href;

    /**
     * 目标（ mainFrame、_blank、_self、_parent、_top）
     */
    private String target;

    /**
     * 图标
     */
    private String icon;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 是否在菜单中显示（1：显示；0：不显示）
     */
    @TableField(value = "is_show")
    private String isShow;

    /**
     * 权限标识
     */
    private String permission;
    private Integer level;

    /**
     * null或0为后台菜单   1--微信菜单
     */
    private String type;

    @TableField(exist = false)
    private String userId;

    @TableField(exist = false)
    private List<Menu> childMenu;

    public Menu() {
        super();
        this.sort = 0;
        this.isShow = "1";
        this.delFlag = 0;
    }

    public Menu getParent() {
        return parent;
    }

    public void setParent(Menu parent) {
        this.parent = parent;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Menu(String id) {
        super(id);
    }

    public String getParentIds() {
        return parentIds;
    }

    public void setParentIds(String parentIds) {
        this.parentIds = parentIds;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getIsShow() {
        return isShow;
    }

    public void setIsShow(String isShow) {
        this.isShow = isShow;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public List<Menu> getChildMenu() {
        return childMenu;
    }

    public void setChildMenu(List<Menu> childMenu) {
        this.childMenu = childMenu;
    }

    public static void sortList(List<Menu> list, List<Menu> sourcelist, String parentId, boolean cascade) {

    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public static String getRootId() {
        return "1";
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Override
    public int compareTo(Object o) {
        return ((Menu) o).getSort().compareTo(this.sort);
    }
}